<?php
class PlusAction extends Action {
    function login(){
        if(!$this->isPost()){
            $this->display();
        }else{
            $mem=M('members');
            $username=$this->_param("username");
            $passwd=$this->_param("passwd");
            $where=array(
                "username"=>$username,
                "passwd"=>md5($passwd),
            );
            $re=$mem->where($where)->find();
            if(!$re){
                $this->error("用户名或密码错误");
            }else{
                session("uid",$re['uid']);
                session("username",$re['username']);
                redirect(U('Index/index'));
            }
        }
    }
    
    function logout(){
        session_destroy();
        redirect(U('Index/index'));
    }
}

